package com.woniuxy.demo.epai.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.demo.epai.model.Product;
import com.woniuxy.demo.epai.vo.ProductVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * <p>
 * 拍品表 Mapper 接口
 * </p>
 *
 * @author epai
 * @since 2021-04-12
 */

public interface ProductMapper extends BaseMapper<Product>{

    List<ProductVo> conditionFindProduct(@Param("pageindex") int pageindex, @Param("pagesize") int pagesize, String classify,
                                         String mode, String status);

    int getCount(String classify,String mode, String status);

    @Insert("insert into e_product (uid,product_name,introduce,image,status,cid,mode,par_id) value(#{uid},#{productName},#{introduce},#{image},#{status},#{cid},#{mode},#{parId})")
    @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
    int addProduct(Product product);
    @Select("select * from e_product where id=#{id}")
    Product queryProductById(Integer id);

}
